var path = require('path');
// var Page = require('./plugins/page');

var webpack = require("webpack");
var ExtractTextPlugin = require("extract-text-webpack-plugin");
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');

module.exports = {
    entry: {
        index: './src/index.js',
    },
    output: {
        filename: 'bound.js',
        path: path.resolve(__dirname,'dist')
    },
    module:{
        loaders: [
            {
                test: /\.(md)$/,
                exclude: /node_modules/,
                loader: 'text-loader'
            },
            {
                test: /\.(js|jsx)$/,
                exclude: /node_modules/,
                loader: 'babel-loader'
                // loader: 'babel-loader!react-loader'
            },
            {
                test: /\.(css|scss)$/,
                loader:ExtractTextPlugin.extract({ fallback: 'style-loader', use: 'css-loader!sass-loader' })
                // loader:"style-loader!css-loader!sass-loader"
            },
            {
                test: /\.(png|jpg)$/,
                use: 'url-loader?limit=8192'
            }
        ]
    },
    externals: {
        'react': 'React',
        'react-dom': 'ReactDOM',
        'react-router': 'ReactRouter',
        'reflux': 'Reflux',
    },
    plugins:  [
        new ExtractTextPlugin("styles.css"),
        new UglifyJSPlugin(),
        new webpack.DefinePlugin({
            "process.env": {
                NODE_ENV: JSON.stringify("production")
            }
        })
    ],
    devServer: {
        host: '0.0.0.0',
        port: 9901
    }
}